package control;

import javax.microedition.lcdui.Graphics;

import main.Res;

public class IconBox extends Control{
	protected int x,y,w,h;
	protected int index; 
	public IconBox(int iconIndex,
			int x,int y, int w, int h) {
		init(iconIndex,x,y, w, h);
	}
	private void init(int iconIndex,
			int x,int y, int w, int h)
	{
		this.x = x;
		this.y = y;
		this.w = w;
		this.h = h;
		index = iconIndex;
	}
	protected void controlPaint(Graphics g)
	{
		g.setColor(COLOR_PRESSED);
		
		g.fillRect(x, y, w, h);
		g.setColor(COLOR_FORE);
		
		g.drawRect(x, y, w, h);
		g.drawRect(x-1, y-1, w+1, h+1);
		//g.drawRect(x+1, y+1, w-2, h-2);
		Res.drawIcon(g, index, x+(w-Res.ICON_SIZE)/2, y+(h-Res.ICON_SIZE)/2);
		
		g.setColor(0x884444);
	}
}
